package com.xzz.finger;

/**
 * @author: hhz
 * @create: 2022-02-21 10:06
 * 剑指 Offer 17. 打印从1到最大的n位数
 **/
public class PrintNumbers {
    public static void main(String[] args) {
        System.out.println(printNumbers(3));
    }

    public static int[] printNumbers(int n) {
        int num = 1;
        for (int i = 0; i < n; i++) {
            num *= 10;
        }
        int[] res = new int[num];
        for (int i = 0; i < num-1; i++) {
            res[i] = i+1;
        }
        return res;
    }
}
